From: White, Edmund H Date: Wed, 13 Aug 2014 19:14:07 +0000 (+0000) Subject: xl: Accept a list for serial in config file X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4509 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ceba2249707724594b268482da34a0725adbe6da;p=xen.git xl: Accept a list for serial in config file Allow the "serial" key to accept a list of serial ports, and pass them in using the new serial_list domain build element. For backwards compatibility, still accept singleton values. Also update the xl.cfg manpage. This patch borrows substantially from the multiple USB device patch c3a2148192705592d38407ba9919eb1eb151a153. Signed-off-by: Ed White Acked-by: Ian Campbell --- diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 index 1e04eed0aa..21ca502553 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -1281,13 +1281,15 @@ an usb2 controller. The default is disabled (0). =over 4 -=item B +=item B -Redirect the virtual serial port to B. Please see the +Redirect virtual serial ports to Bs. Please see the B<-serial> option in the L manpage for details of the valid B options. Default is B when in graphical mode and B if B is used. +The form serial=DEVICE is also accepted for backwards compatibilty. + =item B Select the virtual sound card to expose to the guest. The valid diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index f1c136a534..bdca14b157 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1683,9 +1683,26 @@ skip_vfb: if (!xlu_cfg_get_long (config, "spiceusbredirection", &l, 0)) b_info->u.hvm.spice.usbredirection = l; xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0); - xlu_cfg_get_defbool(config, "gfx_passthru", + xlu_cfg_get_defbool(config, "gfx_passthru", &b_info->u.hvm.gfx_passthru, 0); - xlu_cfg_replace_string (config, "serial", &b_info->u.hvm.serial, 0); + switch (xlu_cfg_get_list_as_string_list(config, "serial", + &b_info->u.hvm.serial_list, + 1)) + { + + case 0: break; /* Success */ + case ESRCH: break; /* Option not present */ + case EINVAL: + /* If it's not a valid list, try reading it as an atom, + * falling through to an error if it fails */ + if (!xlu_cfg_replace_string(config, "serial", + &b_info->u.hvm.serial, 0)) + break; + /* FALLTHRU */ + default: + fprintf(stderr,"xl: Unable to parse serial.\n"); + exit(-ERROR_FAIL); + } xlu_cfg_replace_string (config, "boot", &b_info->u.hvm.boot, 0); xlu_cfg_get_defbool(config, "usb", &b_info->u.hvm.usb, 0); if (!xlu_cfg_get_long (config, "usbversion", &l, 0))